﻿using Inaction.ServiceContract;
using Inaction.Core;
using Inaction.Rule;

namespace Inaction.Extensions.Serialization
{
    public class SerializerHelper : ISerializerHelper
    {
        BaseSerializer defaultSerializer = new BinarySerializer();

        public BaseSerializer DefaultSerializer
        {
            get { return defaultSerializer; }
            set { defaultSerializer = value; }
        }

        public BaseSerializer GetSerializer(SerializeType type)
        {
            switch (type)
            {
                case SerializeType.Xml:
                    return new XmlSerializer();
#if WINDOWS || MONO
                case SerializeType.Binary:
#endif
                    return new BinarySerializer();
                default:
                    return new XmlSerializer();
            }
        }
    }
}
